all games: Fix a case of dynamic shadows bleeding through thin surfaces #1686
+25
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Description
CClientShadowMgr::ComputeExtraClipPlanesbuilds clip planes from the shadow bounding box corner farthest along the shadow direction to prevent dynamic shadows poking through surfaces.If that corner ends up inside or goes through a brush it would cause the shadow to render on the other side of the brush's surface. This can happen when a model stands near a thin brush wall.
To fix this, this PR updates the compute routine to do a trace from the renderable's origin to the bounding box corner and push the corner's origin along the surface normal away from the brush towards the renderable if needed.
Note that this doesn't address the lack of dynamic shadow clipping through walls in the shadow direction because of the engine's hard-coded limit of max 4 clip planes per shadow. If the limit were to be incremented by 3 (1 plane for each axis) it would suffice to provide a fix for that.
Comparison screenshots of some problematic spots on Dustbowl:
Closes ValveSoftware/Source-1-Games#52